SpotCheck and CodeWarrior

Metrowerks' CodeWarrior can be used as the compilation and runtime environment for SpotCheck. This document explains the details of this interface. You should already know how to choose CodeWarrior from among the supported compiler helper applications.

The interface between SpotCheck and CodeWarrior is designed to function transparently, with no need, in most cases, for you to be aware of the details. However, since the interface cannot anticipate all of your needs and preferences in working with CodeWarrior, we are providing the details here in case you should need to customize something.

The interface is also designed to allow you to operate CodeWarrior from within SpotCheck. If you need or prefer to do the opposite, that is, operate SpotCheck from within CodeWarrior, we have included some comments about SpotCheck's limited abilities as an external editor for the CW IDE.

If you have existing CW project documents that you wish to adapt for use with SpotCheck, you should read this document. In addition, you should read it if you are using version 1.2 of Metrowerks Java (from release Pro 2).

Project Names and Stationery

SpotCheck uses a naming convention to associate CodeWarrior project documents with SpotCheck project documents. When you select a command that must interact with CodeWarrior for a project named "MyProject.spot", SpotCheck looks for a CodeWarrior project named "MyProject.vN.N.mcp", where "N.N" is derived from the version of the CW IDE in use. At this writing, the possible values of "N.N" are "1.6", "1.7", "2.0", and "2.1".

If an appropriately named CW project is not found, SpotCheck will create one from its set of CW project stationery files, located in the ":SpotCheck:Metrowerks Support:" folder. If the SpotCheck project in question is an applet project, SpotCheck will use "Applet.vN.N.mcp" as the stationery; otherwise, it will use "App.vN.N.mcp".

SpotCheck uses the "vN.N" naming convention so that you can compile the same SpotCheck project with different versions of the CodeWarrior IDE. This is particularly useful when upgrading from one IDE version to the next.

You can use SpotCheck with your existing CodeWarrior projects simply by renaming each project to conform to the convention described above. If it is unclear what the project name should be, you can create the corresponding SpotCheck project, "reading in" all of the constituent Java text files, then execute the "Compile Project" command. SpotCheck will create a CodeWarrior project with the correct name. You can then simply remove the new project, and rename your existing project with the same name.

As SpotCheck and CodeWarrior continue to mature, the interface between them will almost certainly require new categories and versions of the project stationery files. You can check the "Metrowerks Support" folder to see which CW IDE versions are supported by the current release of SpotCheck.

Default Project Settings

CodeWarrior projects that are created by SpotCheck have preconfigured project settings, inherited from the stationery files. You can change any of the project settings after the project file has been created, but some of them must remain unchanged for SpotCheck's Project menu commands to work. These requirements are described here.

First, your CodeWarrior project must always have the "Use modification date caching" option disabled. If that option is enabled, CodeWarrior will not recognize when SpotCheck has generated modified Java source files. This would mean that you would compile and run Java code that was outdated with respect to changes you had just made in your SpotCheck project.

Second, your CodeWarrior project must be set to generate loose ".class" files in an unnamed class folder, if you want SpotCheck's "Build and Run" command to work. Different versions of the CW IDE specify this setting in slightly different ways; if you want to configure an existing CodeWarrior project so that SpotCheck can run it, check the corresponding project stationery file in ":SpotCheck:Metrowerks Support:" to see how to configure projects for your particular version of the CW IDE.

Any other project settings can be changed without affecting SpotCheck. If you have a setting that you want to adjust for all your SpotCheck-generated CodeWarrior projects, you can adjust the setting in the appropriate project stationery file(s).

Using CW IDE 2.*

Since the release of CW IDE 2.0 (with the Pro 1 release), CodeWarrior can generate multiple "targets" from a single project file. We have made no attempt to modify SpotCheck's CodeWarrior interface to make it cognizant of multiple targets. SpotCheck's CW interface will work as long as the "currently active" target is a Java target that corresponds to the current SpotCheck project. Java text files generated by SpotCheck will be added at least to that target, if not all targets... we have not tested the latter.

SpotCheck as an External Editor

CodeWarrior has the ability to use 3rd-party editor applications, rather than its own text editor, to view text documents. SpotCheck 1.0 has a limited ability to act as such an "external editor", if you want to work primarily within the CodeWarrior IDE. This would probably be particularly useful for developers who are adapting large, multi-target and/or multi-language CodeWarrior projects for use with SpotCheck. You can refer to Metrowerks' documentation to find out how to set up the CW IDE Preferences to use SpotCheck as the external editor.

When SpotCheck is set up as the external editor for CodeWarrior, clicking on any text document entry in a CodeWarrior project will cause SpotCheck to attempt to "open" that document. If the document name ends in ".java", SpotCheck will attempt to locate that "file" in the frontmost project document window. If the name is not found there, SpotCheck will give you the option of opening the file as a text document, or parsing the file as Java text for a new project document. In SpotCheck 1.0, there is currently no option to simply add the indicated Java text file to the frontmost project, although that can be done manually with the "Read In .java file" command.

SpotCheck 1.0's ability as an "external editor" is limited in several other ways as well. First, clicking in CodeWarrior search or error message windows will not produce the expected effect: SpotCheck will simply be activated. Second, there is no way to use SpotCheck as the editor only for Java source files, and still use the CodeWarrior editor (or any other) for other text files. Finally, SpotCheck has no preference setting that would cause the "Compile Project" command to activate CodeWarrior and use its error window rather than reporting errors back to SpotCheck.

All of these shortcomings will be addressed in a future release of SpotCheck.

Using Metrowerks Java

The Metrowerks Java application can be selected as either the applet viewer or the application runner helper for SpotCheck, or both. As with all such helper applications, SpotCheck's interaction with Metrowerks Java relies on the .class or .html files obeying certain invariants.

SpotCheck is able to control most versions of Metrowerks Java, including all those up to and including version 1.0.7, shipped with CW Pro 1. As of this writing, the interface has not been tested with any of the JIT versions of Metrowerks Java.

Users of Metrowerks Java version 1.2, shipped with CW Pro 2, will find that SpotCheck is unable to control that version. This is due to undocumented changes in its AppleEvent handling capabilities. Metrowerks is aware of the problem, and is working on a patch as of this writing. The patch will be available on their website. In the meantime, users will have to execute their Java code by hand, rather than from SpotCheck.